# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DataMigration.V1.Model.MultiColumnDatatypeChange do
  @moduledoc """
  Options to configure rule type MultiColumnDatatypeChange. The rule is used to change the data type and associated properties of multiple columns at once. The rule filter field can refer to one or more entities. The rule scope can be one of:Column. This rule requires additional filters to be specified beyond the basic rule filter field, which is the source data type, but the rule supports additional filtering capabilities such as the minimum and maximum field length. All additional filters which are specified are required to be met in order for the rule to be applied (logical AND between the fields).

  ## Attributes

  *   `customFeatures` (*type:* `map()`, *default:* `nil`) - Optional. Custom engine specific features.
  *   `newDataType` (*type:* `String.t`, *default:* `nil`) - Required. New data type.
  *   `overrideFractionalSecondsPrecision` (*type:* `integer()`, *default:* `nil`) - Optional. Column fractional seconds precision - used only for timestamp based datatypes - if not specified and relevant uses the source column fractional seconds precision.
  *   `overrideLength` (*type:* `String.t`, *default:* `nil`) - Optional. Column length - e.g. varchar (50) - if not specified and relevant uses the source column length.
  *   `overridePrecision` (*type:* `integer()`, *default:* `nil`) - Optional. Column precision - when relevant - if not specified and relevant uses the source column precision.
  *   `overrideScale` (*type:* `integer()`, *default:* `nil`) - Optional. Column scale - when relevant - if not specified and relevant uses the source column scale.
  *   `sourceDataTypeFilter` (*type:* `String.t`, *default:* `nil`) - Required. Filter on source data type.
  *   `sourceNumericFilter` (*type:* `GoogleApi.DataMigration.V1.Model.SourceNumericFilter.t`, *default:* `nil`) - Optional. Filter for fixed point number data types such as NUMERIC/NUMBER.
  *   `sourceTextFilter` (*type:* `GoogleApi.DataMigration.V1.Model.SourceTextFilter.t`, *default:* `nil`) - Optional. Filter for text-based data types like varchar.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :customFeatures => map() | nil,
          :newDataType => String.t() | nil,
          :overrideFractionalSecondsPrecision => integer() | nil,
          :overrideLength => String.t() | nil,
          :overridePrecision => integer() | nil,
          :overrideScale => integer() | nil,
          :sourceDataTypeFilter => String.t() | nil,
          :sourceNumericFilter => GoogleApi.DataMigration.V1.Model.SourceNumericFilter.t() | nil,
          :sourceTextFilter => GoogleApi.DataMigration.V1.Model.SourceTextFilter.t() | nil
        }

  field(:customFeatures, type: :map)
  field(:newDataType)
  field(:overrideFractionalSecondsPrecision)
  field(:overrideLength)
  field(:overridePrecision)
  field(:overrideScale)
  field(:sourceDataTypeFilter)
  field(:sourceNumericFilter, as: GoogleApi.DataMigration.V1.Model.SourceNumericFilter)
  field(:sourceTextFilter, as: GoogleApi.DataMigration.V1.Model.SourceTextFilter)
end

defimpl Poison.Decoder, for: GoogleApi.DataMigration.V1.Model.MultiColumnDatatypeChange do
  def decode(value, options) do
    GoogleApi.DataMigration.V1.Model.MultiColumnDatatypeChange.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DataMigration.V1.Model.MultiColumnDatatypeChange do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
